package cn.com.clearbus.enums;

import org.apache.commons.lang.StringUtils;

public enum HtmlEnum {

    INDEX("","/wx/user/toIndex",""),HELLO("","/wx/hello",".html"),LIST("","/wx/user/list","");

    private String preffix;
    private String name;
    private String suffix;
    private String view;

    HtmlEnum(String preffix,String name,String suffix){
        this.preffix = preffix;
        this.name = name;
        this.suffix = suffix;
        this.view = buildView();
    }

    private String buildView(){
        StringBuilder stringBuilder = new StringBuilder();
        if (!StringUtils.isEmpty(preffix)) {
            stringBuilder.append(preffix);
        }
        if (!StringUtils.isEmpty(name)) {
            stringBuilder.append(name);
        }
        if (!StringUtils.isEmpty(suffix)) {
            stringBuilder.append(suffix);
        }
        return stringBuilder.toString();
    }

    public String getView() {
        return view;
    }
}
